package com.ycsj.goldmedalnewconcept.teacher.activity;

import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.ycsj.common.base.BaseActivity;
import com.ycsj.common.manager.BqaManager;
import com.ycsj.common.manager.SrfManager;
import com.ycsj.goldmedalnewconcept.R;
import com.ycsj.goldmedalnewconcept.teacher.adapter.InviteAdapter;
import com.ycsj.goldmedalnewconcept.teacher.bean.ByqzInfo;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 邀请明细
 * Created by Administrator on 2019/4/2 0002.
 */

public class TeacherInviteActivity extends BaseActivity {
    @BindView(R.id.iv_back)
    ImageView ivBack;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.rv)
    RecyclerView rv;
    @BindView(R.id.srf)
    SmartRefreshLayout srf;
    @BindView(R.id.rl_content)
    RelativeLayout rlContent;
    @BindView(R.id.rl_loading)
    RelativeLayout rlLoading;

    //数据集合
    private List<ByqzInfo> oldDatas;

    //空视图
    private View emptyView;

    //列表适配器
    private InviteAdapter adapter;


    @Override
    protected int getContentLayout() {
        return R.layout.teacher_activity_invite;
    }

    @Override
    protected void init() {

        //初始化状态栏
        initStateBar();

        //初始化下拉刷新和标题
        initState();

        //初始化下拉刷新
        initRv();

    }

    /**
     * 初始化标题
     */
    private void initState() {
        tvTitle.setText("邀请明细");
        SrfManager.setSmartByPullListener(srf, null);
    }

    /**
     * 初始化下拉刷新
     */
    private void initRv() {
        rlLoading.setVisibility(View.GONE);
        oldDatas = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            ByqzInfo info = new ByqzInfo();
            oldDatas.add(info);
        }
        emptyView = View.inflate(this, R.layout.base_rv_common_empty_view_white_bg, null);
        adapter = new InviteAdapter(this, R.layout.rv_item_invite, oldDatas);
        BqaManager.setRv(emptyView, this, adapter, rv);
    }

    /**
     * 点击事件
     *
     * @param v
     */
    @OnClick({R.id.iv_back})
    public void onViewClicked(View v) {
        switch (v.getId()) {
            case R.id.iv_back:
                //返回
                finish();
                break;
        }
    }
}
